{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 5. 蜡烛图形态\n",
    "**用TA_Lib寻找蜡烛图特征**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 目录\n",
    "- 蜡烛图是什么？\n",
    "- 蜡烛图的两大用途是什么？\n",
    "- 常见蜡烛图是怎么计算的？\n",
    "- 蜡烛图如何用图表显示，并用TA_Lib寻找蜡烛图？"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 蜡烛图是什么？\n",
    "蜡烛图又称为K线图，主要包含四个数据，即开盘价、最高价、最低价、收盘价，所有的蜡烛图都是围绕这四个数据展开，反映大势的状况和价格信息。如果把每日的K线图放在一张图中，就能得到日K线图，同样也可画出周K线图、月K线图。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 蜡烛图的两大用途是什么？\n",
    "1. 判断反转信号\n",
    "2. 判断持续信号"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 常见蜡烛图是怎么计算的？\n",
    "---\n",
    "### 1. 大阳线: 涨幅大于5%，上下影线小于1.8%\n",
    "\n",
    "$Close/Open>1.05$\n",
    "\n",
    "$High/Low < Close/Open+0.018$\n",
    "\n",
    "---\n",
    "\n",
    "### 2. 大阴线： 跌幅大于5%， 上下影线小于1.8%\n",
    "\n",
    "$Open/Close > 1.05$\n",
    "\n",
    "$High/Low < Open/Close+0.018$\n",
    "\n",
    "---\n",
    "\n",
    "### 3.下影线\n",
    "\n",
    "$(Min(Close,Open)-Low)/(High-Low)>0.667$\n",
    "\n",
    "---\n",
    "\n",
    "### 4. 上影线\n",
    "$(High-Max(Close,Open))/(High-Low)>0.667$\n",
    "\n",
    "---\n",
    "\n",
    "### 5.十字星\n",
    "$Close-Open<Abs(0.001)$\n",
    "\n",
    "$High-Low>0.001$\n",
    "\n",
    "### 6. 缺口Gap\n",
    "$open[-1]-close[-2]>0.01$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 蜡烛图如何用图表显示，并用TA_Lib寻找蜡烛图？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                date   open  close   high    low    volume    code\n",
      "datetime                                                          \n",
      "2016-11-01  736269.0  17.87  17.98  17.99  17.79  189405.0  600036\n",
      "2016-11-02  736270.0  17.86  17.84  17.94  17.76  309535.0  600036\n",
      "2016-11-03  736271.0  17.83  17.93  17.97  17.79  270809.0  600036\n",
      "2016-11-04  736272.0  17.90  17.91  18.00  17.87  269388.0  600036\n",
      "2016-11-07  736275.0  17.91  17.89  17.93  17.85  208258.0  600036\n"
     ]
    }
   ],
   "source": [
    "import talib as ta\n",
    "import tushare as ts\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import pandas as pd\n",
    "from matplotlib.dates import DateFormatter, WeekdayLocator,\\\n",
    "    DayLocator, MONDAY, date2num\n",
    "from datetime import datetime\n",
    "from mpl_finance import candlestick_ochl\n",
    "\n",
    "quotes = ts.get_k_data('600036', start='2016-11-01', end='2016-12-31', ktype='D',autype='qfq')\n",
    "quotes['datetime'] = pd.to_datetime(quotes['date'],format='%Y-%m-%d')\n",
    "quotes['date']=[date2num(datetime.strptime(date, '%Y-%m-%d')) for date in quotes.date]\n",
    "quotes.index = quotes.datetime\n",
    "quotes.pop('datetime')\n",
    "\n",
    "print quotes.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "candle_list = []\n",
    "for i in range(len(quotes)):\n",
    "    candle_list.append(quotes.iloc[i, 0:5])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAESCAYAAADzBx6n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amf4Dwc+oGwllkpgMvB86LX0pJZ1GeSbOc\nSRg19SJCT41ZhCbIqwhbiB8k7HuaTjhJxqvd/bYisihP/2RpybW9P76ZrSM0F/1vwqimDxPOtfEW\nr/K8tDn8ZDmDsANkON6eRhgwaA5hkP8yji59HqH56MOEYWEPJgyMNkoYf2SQcNajPyecrKKwIVrr\nlEV5Js1yOqG77xHxdnPMoyMIhWQpoXPBycAfAnMLXjbK0wdZxsk3LXP9BsK5Gc6L63nuY9d0nS+H\nf3BW/JC+n7Fjt59DOLlBGTuIFgCPE3r5vJlw7sfXE7YQ30HYOjyspDe8NlmUZ9Is8wkjBL4y3jbi\ncMuxsHyNgjsOKE//ZZkgY7bYfwH4arv7qrj03L3S3R8zs7+JH9a/NrONhGFHXwGc7yUM0eruP7Rw\nmPE3CAXkTMJO4mFCu9gCYJqZvQPY5nHJp55FeSbNstnMTga+ZuHcsx83sycsnIT514RmgMeKmr/y\n9GeWCTJD8PjvAAABAUlEQVRuH1bB3V9u4WC/i9z9Ki/hKNzJwuX1bbYnoXvcXwJvpaTBgloynEg4\nX+kF8fZ0wqHQF1PCGXXqmkV5Js2yEPgF8MeZaRcQeovtWcGyUZ4+yDJBxuYgd5cA76o6j3sOTTd1\nu8QCMmZFUBbl6SBLs4C8krAf4YeUOCy08vRnlgky7g5cSYlDeU+Yp+oABS3kYUJXp9cpi/J0kWVh\nzNKo4leO8vRnlgkyljIEcSeXwoYprlo89PjXXvahxjXPAsozSZZjCKfbqzwLKE+/ZKm7ZAu9iIgE\npZ8cXEREyqVCLyKSOBV6EZHEqdCLiCROhV5EJHEq9CIiiVOhFxFJ3H8B/sDyt2JrBMUAAAAASUVO\nRK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xbe12320>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "mondays = WeekdayLocator(MONDAY)        # major ticks on the mondays\n",
    "alldays = DayLocator()              # minor ticks on the days\n",
    "weekFormatter = DateFormatter('%b %d')  # e.g., Jan 12\n",
    "fig, (ax, ax1) = plt.subplots(2, 1, sharex=True)\n",
    "ax.xaxis.set_major_locator(mondays)\n",
    "ax.xaxis.set_minor_locator(alldays)\n",
    "ax.xaxis.set_major_formatter(weekFormatter)\n",
    "\n",
    "candlestick_ochl(ax, candle_list, width=0.6)\n",
    "ax.xaxis_date()\n",
    "ax.autoscale_view()\n",
    "ax.grid(True)\n",
    "plt.setp(plt.gca().get_xticklabels(), rotation=45, horizontalalignment='right')\n",
    "\n",
    "Doji = ta.abstract.CDLDOJI(quotes)\n",
    "quotes['Doji'] = Doji\n",
    "ax1.bar(quotes.index, quotes.Doji)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 作业\n",
    "根据上面代码寻找其他蜡烛图形态。"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
